<?php

class IndexController extends Zend_Controller_Action {

    public function indexAction() {}

    public function testUploadAction() {}
    
    public function xmlLoginAction() {
    	
		$email = $this->_getParam("email");
		$password = $this->_getParam("password");
		
		if ($email === null || $password === null) {
			$output = <<<XML
<output>
	<result>
		false
	</result>
	<error>
		<code>
			0
		</code>
		<message>
			Email or password not given.
		</message>
	</error>
</output>
XML;
		} else {
			
			$email = trim($email);
			$password = trim($password);
			$application_model_user = new Application_Model_User();
			if (!$application_model_user->login($email, $password)) {
				$output = <<<XML
<output>
	<result>
		false
	</result>
	<error>
		<code>
			1
		</code>
		<message>
			Login fails.
		</message>
	</error>
</output>
XML;
			} else {
				$output = <<<XML
<output>
	<result>
		true
	</result>
</output>
XML;
			}
			
		}
		
		exit($output);
    	
    }
    
}